import App from './App'
import '@/utils/utils.js'

import { createSSRApp } from 'vue'
import { createPinia } from 'pinia'
import { createPersistedState } from 'pinia-plugin-persistedstate'
export function createApp() {
  const app = createSSRApp(App)
  const pinia = createPinia()
  pinia.use(
    createPersistedState({
      key(storeId) {
        return '_persistedstate_' + storeId
      },
      storage: {
        setItem(key, value) {
          return uni.setStorageSync(key, value)
        },
        getItem(key) {
          return uni.getStorageSync(key)
        }
      }
    })
  )
  app.use(pinia)
  return {
    app
  }
}
